//
//  UTSIntercom.swift
//  UTSIntercom
//
//  Created by 温日盛 on 2024/8/25.
//

import Foundation
import Intercom

public func UTSloginUnidentifiedUser( sucHandle: @escaping ()-> Void, failHandle: @escaping (_ error: Error)->Void) {
    Intercom.loginUnidentifiedUser { result in
           switch result {
           case .success: 
               sucHandle()
               break
           case .failure(let error):
               failHandle(error)
               break
           }
    }
}

public func UTSLoginUser(user: ICMUserAttributes, sucHandle: @escaping ()-> Void, failHandle: @escaping (_ error: Error)->Void) {
    Intercom.loginUser(with: user) { result in
        switch result {
        case .success:
            sucHandle()
            break
        case .failure(let error):
            failHandle(error)
            break
        }
    }
}

public func UTSUpdateUser(user: ICMUserAttributes, sucHandle: @escaping ()-> Void, failHandle: @escaping (_ error: Error)->Void) {
    Intercom.updateUser(with: user) { result in
        switch result {
        case .success:
            sucHandle()
            break
        case .failure(let error):
            failHandle(error)
            break
        }
    }
}

func test() {


}
